{% extends 'admin_panel/base.html' %}

{% block title %}仪表盘 - 旅行记录管理系统{% endblock %}
{% block page_title %}仪表盘{% endblock %}

{% block content %}
<div class="row mb-4">
    <!-- 统计卡片 -->
    <div class="col-md-3 mb-3">
        <div class="card stat-card bg-primary text-white">
            <div class="card-body text-center">
                <i class="bi bi-journal-text display-4 mb-2"></i>
                <h3>{{ total_travels }}</h3>
                <p class="mb-0">总旅行记录</p>
            </div>
        </div>
    </div>
    
    <div class="col-md-3 mb-3">
        <div class="card stat-card bg-success text-white">
            <div class="card-body text-center">
                <i class="bi bi-people display-4 mb-2"></i>
                <h3>{{ total_users }}</h3>
                <p class="mb-0">总用户数</p>
            </div>
        </div>
    </div>
    
    <div class="col-md-3 mb-3">
        <div class="card stat-card bg-info text-white">
            <div class="card-body text-center">
                <i class="bi bi-chat-dots display-4 mb-2"></i>
                <h3>{{ total_comments }}</h3>
                <p class="mb-0">总评论数</p>
            </div>
        </div>
    </div>
    
    <div class="col-md-3 mb-3">
        <div class="card stat-card bg-warning text-dark">
            <div class="card-body text-center">
                <i class="bi bi-heart display-4 mb-2"></i>
                <h3>{{ total_likes }}</h3>
                <p class="mb-0">总点赞数</p>
            </div>
        </div>
    </div>
</div>

<div class="row">
    <!-- 最近活动 -->
    <div class="col-md-6 mb-4">
        <div class="card">
            <div class="card-header">
                <h5 class="card-title mb-0">最近7天活动</h5>
            </div>
            <div class="card-body">
                <div class="row text-center">
                    <div class="col-6">
                        <div class="border-end">
                            <h4 class="text-primary">{{ recent_travels }}</h4>
                            <p class="text-muted mb-0">新增旅行记录</p>
                        </div>
                    </div>
                    <div class="col-6">
                        <div>
                            <h4 class="text-success">{{ recent_users }}</h4>
                            <p class="text-muted mb-0">新增用户</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- 热门地点 -->
    <div class="col-md-6 mb-4">
        <div class="card">
            <div class="card-header">
                <h5 class="card-title mb-0">热门旅行地点</h5>
            </div>
            <div class="card-body">
                {% if popular_locations %}
                <div class="list-group list-group-flush">
                    {% for location in popular_locations %}
                    <div class="list-group-item d-flex justify-content-between align-items-center">
                        <span>{{ location.location }}</span>
                        <span class="badge bg-primary rounded-pill">{{ location.count }}</span>
                    </div>
                    {% endfor %}
                </div>
                {% else %}
                <p class="text-muted">暂无热门地点数据</p>
                {% endif %}
            </div>
        </div>
    </div>
</div>

<div class="row">
    <!-- 快速操作 -->
    <div class="col-12">
        <div class="card">
            <div class="card-header">
                <h5 class="card-title mb-0">快速操作</h5>
            </div>
            <div class="card-body">
                <div class="row">
                    <div class="col-md-3 mb-2">
                        <a href="{% url 'admin_panel:admin_travel_list' %}" class="btn btn-outline-primary w-100">
                            <i class="bi bi-list-ul me-2"></i>查看所有旅行
                        </a>
                    </div>
                    <div class="col-md-3 mb-2">
                        <a href="{% url 'admin_panel:admin_user_list' %}" class="btn btn-outline-success w-100">
                            <i class="bi bi-people me-2"></i>管理用户
                        </a>
                    </div>
                    <div class="col-md-3 mb-2">
                        <a href="{% url 'admin_panel:admin_comment_list' %}" class="btn btn-outline-info w-100">
                            <i class="bi bi-chat-dots me-2"></i>查看评论
                        </a>
                    </div>
                    <div class="col-md-3 mb-2">
                        <a href="{% url 'admin:index' %}" class="btn btn-outline-secondary w-100">
                            <i class="bi bi-gear me-2"></i>Django Admin
                        </a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}
